# GLOBALS GO HERE!

# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

init:    
    
    # ------------- CONSTANTS ------------------------
    
    #balancing stats
    $ MIN_ATTRIBUTE_VALUE = 0
    $ MAX_ATTRIBUTE_VALUE = 255
    $ MAX_RELATIONSHIP_VALUE = 100
    $ MAX_ENERGY_VALUE = 100
    $ TOTAL_DAYS = 1100
    $ MAX_CHARM = 15
    $ MAX_RECIPE_LEVEL = 4
    $ SALARY_RANGE = 0.20
    
    $ COUNT_DESSERT = 16
    $ COUNT_DRINK = 16
    $ COUNT_MEAL = 16
    
    $ RECIPE_TOTALPAGES = 4
    
    $ MAX_INTERVIEW_QUESTIONS = 5
    
    #mission
    $ CHAPTER1_GOAL = 6000
    $ CHAPTER2_GOAL = 15000
    $ CHAPTER3_GOAL = 24735 #NET WORTH
    
    #submission
    $ SUBMISSION1_GOAL = 5000
    $ SUBMISSION2_GOAL = 8000
    $ SUBMISSION3_GOAL = 3000
    
    #length
    $ LENGTH_FIRSTNAME = 12
    $ LENGTH_LASTNAME = 12
    
    #other names
    $ CURRENCY = "Doki"
    
    
    #paths
    $ XML_WEATHER_FILELOC = "xml/WeatherVNBooklet.xml"
    
    # used by someone else
    $ sdissolve = Dissolve(0.25) # a faster dissolve
    $ vfdissolve = Dissolve(0.10) # very fast dissolve
    $ vslowdissolve = Dissolve(2.00) # very slow dissolve
    
    # ------------- EVENTS ---------------------------
    
    $subquests_cleared = 0
    $true_end_path = True
    
    # ------------- ENUMS ----------------------------
    
    #enums for CAFE ACTIONS
    $ INACTIVE = 0
    $ SERVE = 1
    $ COOK = 2
    $ PERFORM = 3
    $ HANGOUT = 4
    $ REST = 5
    
    #enums for FOOD TYPES
    $ DRINK = 0
    $ DESSERT = 1
    $ MEAL = 2
    
    #enums for CHARACTER MOODS
    $ NEUTRAL = 0
    $ HAPPY = 1
    $ ANGRY = 2
    $ SAD = 3
    $ SURPRISED = 4
    $ BLUSH = 5
    
    #enums for CAFE STAT AREAS
    $ REP = 0
    $ APPEAL = 1
    $ CLEANLINESS = 2
    $ LUCK = 3
    
    #recipe pages
    $ DRINK = 0
    $ DESSERT = 1
    $ MEAL = 2
    
    #enums for PLAYER STATS
    $ COURAGE = 0
    $ CHARM = 1
    $ CRAFT = 2
    
    #enums for GENDER
    $ MALE = 0
    $ FEMALE = 1
    
    #enums for RELATIONSHIP STATUS
    $ UNDECIDED = 0
    $ FRIENDS = 1
    $ LOVERS = 2
    
    #enums for TUTORIAL
    $ TUTORIAL_UNFINISHED = 0
    $ TUTORIAL_INPROGRESS = 1
    $ TUTORIAL_FINISHED = 2
    
    $ TUTORIAL_CAFEBASIC = 0

    # ------------- DEFINE CHARACTERS --------------------
    
    define astrid_stats = Employee("Astrid", 16, FEMALE)
    define blanche_stats = Employee("Blanche", 17, FEMALE)
    define kyra_stats = Employee("Kyra", 16, FEMALE)
    define zeno_stats = Employee("Zeno", 18, MALE)
    define ean_stats = Employee("Ean", 16, MALE)
    define levi_stats = Employee("Levi", 19, MALE)
    
    define astrid = Character('Astrid', color="#c8ffc8", ctc = anim.Blink("images/ui/ui_button_next.png"))
    define blanche = Character('Blanche', color="#c8ffc8")
    define kyra = Character('Kyra', color="#c8ffc8")
    define zeno = Character('Zeno', color="#c8ffc8")
    define ean = Character('Ean', color="#c8ffc8")
    define levi = Character('Levi', color="#c8ffc8")
    define levi_who = Character('Servant', color="#c8ffc8")
    
    define all = Character('All', color="#c8ffc8")
    
    define e = Character ('Eileen', color="#c8ffc8", what_ypos = 15, ctc = anim.Blink("images/ui/ui_button_next.png"))
    
    define mom = Character('Mom', color="#c8ffc8")
    define dad = Character('Dad', color="#c8ffc8")
    define customer = Character('Customer', color="#c8ffc8")
    define customer_male = Character('Male Customer', color="#c8ffc8")
    define customer_female = Character('Female Customer', color="#c8ffc8")
    define customer_violent = Character('Violent Customer', color="c8ffc8")
    define customer_flirt = Character('Flirt Customer', color="c8ffc8")
    define dogtag = Character('Douglas', color="#c8ffc8")
    define accessories = Character('Paccio', color="#c8ffc8")
    define officer = Character('Officer', color = "#c8ffc8")
    define officer2 = Character('Trainee Officer', color = "#c8ffc8")
    
    define npc_servant = Character ('Servant', color="#8cffc8")
    define npc_crow = Character('Crowbot', color="#c8ffc8")
    define npc_guardian = Character('Angela', color="#c8ffc8")
    define npc_sickboy = Character('Child', color="#c8ffc8")
    define flora = Character('Flora', color="#c8ffc8")
    
    define unknown = Character('???', color="#c8ffc8")
    
    # ------------ OTHER TEMPORARY GLOBALS ---------------
    #QQQQQ
    $ selected_action = ""
    $ selected_character = ""
    $ active_recipe_tab = DRINK
    $ recipe_page = 1
    $ recipe_index = 0
    $ astrid_activity = REST
    $ blanche_activity = REST
    $ kyra_activity = REST
    $ zeno_activity = REST
    $ ean_activity = REST
    $ levi_activity = REST
    
    $ prog_efficiency = 0
    $ prog_totalserve = 0
    $ prog_totalcook = 0
    $ prog_totalperform = 0
    
    $ refresh_flag = False
    
    $activeone = ""
    
    $take_revenge = True
    
    $kyra_gift = ""
    
    $sabotage_spice = 0
    $sabotage_lives = 5
    
    
    
    
    # ------------ INIT STATUS ---------------
    python:
        
        player = Player("Ako")
        calendar = Calendar()
        calendar.init_calendar_days()
        cafe = Cafe("Kyaaafe")
        
    # ------------ INIT XML DATA -------------
    
        recipe_drinks = []
        recipe_desserts = []
        recipe_meals = []
        
        import xml.etree.ElementTree as elementtree
        import math
        
        ## ------------- DRINKS ------------------------
        tree = elementtree.parse(renpy.loader.transfn("xml/DrinksList.xml"))
        root = tree.getroot()
        for entry in root.iter('item_entry'):
            item_name = ""
            item_upgradecost = 0
            item_recipecost = 0
            item_dayavailable = 0
            item_imageurl = ""
            item_profits = []
            new_drink = Null
            
            item_upgradecost = int(entry.find('upgrade_cost').text) 
            item_name = entry.find('name').text
            item_recipecost = int(entry.find('recipe_cost').text)
            item_profits.append(int(entry.find('profit1').text))
            item_profits.append(int(entry.find('profit2').text))
            item_profits.append(int(entry.find('profit3').text))
            item_profits.append(int(entry.find('profit4').text))
            item_dayavailable = int(entry.find('day_available').text)
            item_imageurl = entry.find('image_url').text + ".png"
            
            new_drink = Item(item_name, DRINK, item_upgradecost, item_profits, item_dayavailable, item_imageurl)
            
            recipe_drinks.append(new_drink)
        
        ## ------------- DESSERTS ------------------------
        tree = elementtree.parse(renpy.loader.transfn("xml/DessertsList.xml"))
        root = tree.getroot()
        
        for entry in root.iter('item_entry'):
            item_name = ""
            item_upgradecost = 0
            item_recipecost = 0
            item_dayavailable = 0
            item_imageurl = ""
            item_profits = []
            new_dessert = Null
            
            item_upgradecost = int(entry.find('upgrade_cost').text) 
            item_name = entry.find('name').text
            item_recipecost = int(entry.find('recipe_cost').text)
            item_profits.append(int(entry.find('profit1').text))
            item_profits.append(int(entry.find('profit2').text))
            item_profits.append(int(entry.find('profit3').text))
            item_profits.append(int(entry.find('profit4').text))
            item_dayavailable = int(entry.find('day_available').text)
            item_imageurl = entry.find('image_url').text + ".png"
            
            new_dessert = Item(item_name, DESSERT, item_upgradecost, item_profits, item_dayavailable, item_imageurl)
            
            recipe_desserts.append(new_dessert)
        
        ## ------------- MEALS ------------------------
        tree = elementtree.parse(renpy.loader.transfn("xml/MealsList.xml"))
        root = tree.getroot()
        for entry in root.iter('item_entry'):
            item_name = ""
            item_upgradecost = 0
            item_recipecost = 0
            item_dayavailable = 0
            item_imageurl = ""
            item_profits = []
            new_meal = Null
            
            item_upgradecost = int(entry.find('upgrade_cost').text) 
            item_name = entry.find('name').text
            item_recipecost = int(entry.find('recipe_cost').text)
            item_profits.append(int(entry.find('profit1').text))
            item_profits.append(int(entry.find('profit2').text))
            item_profits.append(int(entry.find('profit3').text))
            item_profits.append(int(entry.find('profit4').text))
            item_dayavailable = int(entry.find('day_available').text)
            item_imageurl = entry.find('image_url').text + ".png"
            
            new_meal = Item(item_name, MEAL, item_upgradecost, item_profits, item_dayavailable, item_imageurl)
            
            recipe_meals.append(new_meal)